package com.ae.controller;

import com.ae.pojo.Subject;
import com.ae.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author bug-termination
 * @date 2020-10-19 20:23
 */
@Controller
@RequestMapping("subject")
public class SubjectController {
    @Autowired
    private SubjectService subjectService;

    @RequestMapping("selectAll")
    public ModelAndView selectAll() {
        List<Subject> subjectList = subjectService.selectAll();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("subjectList", subjectList);
        modelAndView.setViewName("/before/index.jsp");
        return modelAndView;
    }
}
